apiVersion: apps/v1
kind: Deployment
metadata:
  name: milvu-etcd
  labels:
    app.kubernetes.io/name: milvus-etcd
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name:  milvus-etcd
  template:
    metadata:
      labels:
        app.kubernetes.io/name: milvus-etcd
    spec:
      containers:
      - name: milvus-etcd
        image: quay.io/coreos/etcd:v3.5.5
        command:
        - etcd
        - -advertise-client-urls=http://127.0.0.1:2379
        - -listen-client-urls
        - http://0.0.0.0:2379
        - --data-dir
        - /etcd
        env:
        - name: ETCD_AUTO_COMPACTION_MODE
          value: revision
        - name: ETCD_AUTO_COMPACTION_RETENTION
          value: "1000"
        - name: ETCD_QUOTA_BACKEND_BYTES
          value: "4294967296"
        - name: ETCD_SNAPSHOT_COUNT
          value: "50000"
        ports:  
        - containerPort: 2379
        readinessProbe:
          exec:
            command:
            - etcdctl
            - endpoint
            - health
          initialDelaySeconds: 5
          periodSeconds: 5
        volumeMounts:
        - mountPath: /etcd
          name: etcd-data
      volumes:
      - name: etcd-data
        hostPath:
          path: /etcd
          type: DirectoryOrCreate
---
apiVersion: v1
kind: Service
metadata:
  name:  milvus-etcd
spec:
  selector:
    app.kubernetes.io/name: milvus-etcd
  ports:
    - protocol: TCP
      port: 2379
      targetPort: 2379 